#include <core_macros.h>

if (!isDedicated && hasInterface) then {
	if (!isnil "tyr_fnc_addHandler") then {
		["TYRMENU",[
			// Build trench
			[
				localize "STR_XS_BUILDTRENCH"
				,{!visibleMap && {vehicle player == player}}
				,{0 spawn FUNC(spawntrench)}
				,"tmf\support\modules\x_scripts\trench.paa"
			],
			// Chem light attach
			[
				localize "STR_XS_ATTACHCHEM"
				,{((player getVariable [QGVAR(p_clattached), ""] == "") && {count (call FUNC(haschemlight)) > 0})}
				,{
					private ["_chemar"];
					_chemar = call FUNC(haschemlight);
					if (count _chemar > 0) then {
						(_chemar select 0) call FUNC(attachchemlight);
					};
				}
				,"tmf\support\modules\x_scripts\chemlight.paa"
			],
			// Chem light detach
			[
				localize "STR_XS_DETACHCHEM"
				,{((player getVariable [QGVAR(p_clattached), ""] != ""))}
				,FUNC(detachchemlight)
				,"tmf\support\modules\x_scripts\chemlight.paa"
			]
		]] call tyr_fnc_addHandler;
	};
	if (EnablePlayerNames > 0) then {
		GVAR(NH_friendly_color) = [0.6, 0.6, 0.9, 1];
		if (playerSide == east) then { GVAR(NH_friendly_color) = [0.9, 0.6, 0.6, 1]; };
		GVAR(NH_showPlayerNameRSC_shown) = false;
		GVAR(NH_dist_pname_hud) = 40;
		GVAR(NH_display_unc) = false;
		GVAR(NH_showNames) = true;
		["XENO_NAME_HUD", "onEachFrame", FUNC(playernamehuddo)] call BIS_fnc_addStackedEventHandler;
		
		if (!isnil "tyr_fnc_addHandler") then {
			["TYRMENU",[
				[
					localize "STR_X_NAMEHUDSHOW"
					,{!GVAR(NH_showNames)}
					,{
						GVAR(NH_showNames) = true;
						systemChat localize "STR_X_NAMESON";
					}
					,"tmf\support\modules\x_scripts\nameson.paa"
				]
				,[
					localize "STR_X_NAMEHUDHIDE"
					,{GVAR(NH_showNames)}
					,{
						GVAR(NH_showNames) = false;
						systemChat localize "STR_X_NAMESOFF";
					}
					,"tmf\support\modules\x_scripts\namesoff.paa"
				]
			]] call tyr_fnc_addHandler;
		};
	};
};